<template>
  <el-card>
    <div class="box">
      <img :src="userStore.avatar" alt="" class="avatar" />
      <div class="info">
        <div class="name">{{ getTime() }}好！{{ userStore.userName }}</div>
        <div class="title">硅谷甄选运营平台</div>
      </div>
    </div>
  </el-card>
  <svg-icon name="welcome" width="40vw" height="40vw" class="welcome"></svg-icon>
</template>

<script setup lang="ts">
import { onMounted } from 'vue'
import { getTime } from '@/utils/time';
// 引入用户信息仓库
import useUserStore from '@/store/modules/user'
const userStore = useUserStore()
onMounted(async () => {
  await userStore.getUserInfo()
})
</script>

<style scoped lang="scss">
.box {
  display: flex;
  align-items: center;

  .avatar {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 50%;
  }

  .info {
    margin-left: 20px;

    .name {
      font-size: 30px;
      font-weight: 300;
    }

    .title {
      font-size: 16px;
      color: #777;
      margin-top: 10px;
      // 文字倾斜
      font-style: italic;
      transform: rotate(-10deg) translate(0, -10px);
    }
  }
}

.welcome {
  // 居中
  text-align: center;
}
</style>
